<template>
	<view class="content">
		<navBack />
		<image src="/static/bg.png" mode="" class="box-bg"></image>

		<view class="" v-for="item in voteRecordsData">
			<view class="card">
				<view class="_title_" style="margin-bottom: 12rpx;">
					投票记录
				</view>

				<view class="poll-state">
					投票结束
				</view>

				<view class="lable">
					<view class="">
						房产
					</view>
					<view class="">
						{{item.position}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						维修项目
					</view>
					<view class="">
						{{item.voteRecord.projectName}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						项目编号
					</view>
					<view class="">
						{{item.voteRecord.projectName}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						投票开始时间
					</view>
					<view class="">
						{{item.voteRecord.startTime}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						投票结束时间
					</view>
					<view class="">
						{{item.voteRecord.endTime}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						完成投票时间
					</view>
					<view class="">
						{{item.voteRecord.finisheTime}}
					</view>
				</view>
			</view>


			<view class="card">
				<view class="lable">
					<view class="">
						投票总人数
					</view>
					<view class="">
						{{item.voteRecord.totalCount}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						投票总面积
					</view>
					<view class="">
						{{item.voteRecord.totalArea}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						参与投票人数
					</view>
					<view class="">
						{{item.voteRecord.voteCount}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						参与投票面积
					</view>
					<view class="">
						{{item.voteRecord.voteArea}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						投票同意人数
					</view>
					<view class="">
						{{item.voteRecord.agreeCount}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						投票同意面积
					</view>
					<view class="">
						{{item.voteRecord.agreeArea}}
					</view>
				</view>
			</view>

			<view class="card">
				<view class="vote-statistics">
					<view class="">
						<view class="vote-statistics-item vote-statistics-item0">
							<view class="">
								投票总人数
							</view>
							<view class="">
								{{item.voteRecord.totalCount}}
							</view>
						</view>

						<view class="vote-statistics-item vote-statistics-item0">
							<view class="">
								投票总面积
							</view>
							<view class="">
								{{item.voteRecord.totalArea}}
							</view>
						</view>
					</view>
					<view class="">
						<view class="vote-statistics-item vote-statistics-item1">
							<view class="">
								参与投票人数
							</view>
							<view class="">
								{{item.voteRecord.voteCount}}
							</view>
						</view>
					
						<view class="vote-statistics-item vote-statistics-item1">
							<view class="">
								参与投票面积
							</view>
							<view class="">
								{{item.voteRecord.voteArea}}
							</view>
						</view>
					</view>
					<view class="">
						<view class="vote-statistics-item vote-statistics-item2">
							<view class="">
								投票同意人数
							</view>
							<view class="">
								{{item.voteRecord.agreeCount}}
							</view>
						</view>
					
						<view class="vote-statistics-item vote-statistics-item2">
							<view class="">
								投票同意面积
							</view>
							<view class="">
								{{item.voteRecord.agreeArea}}
							</view>
						</view>
					</view>
				</view>

				<view class="statistics">
					同意比例：人数比76% 面积比81%
				</view>

				<view class="statistics-explain">
					投票结果：投票人数和面积均大于法律规定的2/3比例，因此将遵循业主意愿，同意维修！
				</view>

			</view>


			<view class="card">
				<view class="lable">
					<view class="">
						投票人
					</view>
					<view class="">
						{{item.voterName}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						投票时间
					</view>
					<view class="">
						{{item.voteTime}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						是否同意
					</view>
					<view class="">
						{{item.isAgree?'同意':'不同意'}}
					</view>
				</view>
				<view class="lable">
					<view class="">
						是否有修改过投票结果
					</view>
					<view class="">
						{{item.isChanged?'已修改':'未修改'}}
					</view>
				</view>
				<view class="lable" v-if="item.isChanged">
					<view class="">
						修改时间
					</view>
					<view class="">
						{{item.changeTime}}
					</view>
				</view>
			</view>

		</view>
		
		<view class="empty" v-if="!voteRecordsData.length">
			<image src="/static/empty.png" mode=""></image>
			<view class="">
				空空如也
			</view>
		</view>
		<Loading />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				voteRecordsData: []
			}
		},
		onLoad() {
			this.$myRequest('/api/voteRecords').then(res => {
				this.voteRecordsData = res.data
			})

		},
		methods: {

		}
	}
</script>

<style lang="scss">
	.content {
		background-color: #f5f5f5;
		padding: 172rpx 20rpx 28rpx 20rpx;
		min-height: calc(100vh - 200rpx);

		.card {
			padding: 24rpx 20rpx;

			.poll-state {
				font-size: 28rpx;
				font-weight: 700;
				color: #ff0000;
				position: absolute;
				top: 24rpx;
				right: 20rpx;
			}

			.vote-statistics {
				display: flex;
				justify-content: space-between;

				>view {
					width: 194rpx;
					height: 282rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.vote-statistics-item {
						padding: 10rpx 0;
						text-align: center;
						width: 194rpx;
						height: 106rpx;
						border-radius: 8rpx;
						display: flex;
						flex-direction: column;
						justify-content: space-around;

						>view:nth-child(2) {
							font-weight: 700;
						}
					}

					.vote-statistics-item0 {
						color: #2F75F1;
						background-color: rgba(47, 117, 241, .2);
					}

					.vote-statistics-item1 {
						color: #FE7E14;
						background-color: rgba(254, 126, 20, .2);
					}

					.vote-statistics-item2 {
						color: #FEA90E;
						background-color: rgba(254, 169, 14, .2);
					}
				}
			}

			.statistics {
				background-color: rgba(255, 48, 48, .2);
				color: #FF3030;
				border-radius: 8rpx;
				text-align: center;
				height: 72rpx;
				line-height: 72rpx;
				font-size: 28rpx;
				margin: 34rpx 0;
			}

			.statistics-explain {
				color: #FF3030;
				font-weight: 700;
				font-size: 28rpx;
			}

		}
	}
</style>